<%@ Page Language="VB" %>
<%@ Register Namespace=Microsoft.Samples.Alert TagPrefix=ms %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat='server'>
    
    Public Sub ServerShow(ByVal sender As Object, ByVal e As EventArgs)
        ServerAlert.Show
    End Sub
    
    Public Sub ServerAlertChoice(ByVal sender As Object, ByVal e As AlertChoiceEventArgs)
        AlertResult.Text = ("You clicked " & e.Result.ToString)
        AlertResult.Visible = true
    End Sub
    
    Public Sub ConfirmClick(ByVal sender As Object, ByVal e As EventArgs)
        ConfirmResult.Visible = true
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Alert WebControl</title>
    <style>
        body {font-name:Arial}
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        This page shows different uses of the Alert and ConfirmButton controls.<br />
        <%-- Don't use CssClass on an alert because it's a different window. Use inline styles instead. --%>
        <ms:Alert ID=ServerAlert runat=server Buttons=OK Title="Server Alert" OnChoice=ServerAlertChoice
            Font-Names="Arial" HorizontalAlign=Center Width=350px Height=100px>
            This is a rich alert box that was triggered by<br /><i>server-side code</i>.<br />
        </ms:Alert>
        <ms:Alert ID=ClientAlert runat=server Buttons=YesNoCancel Title="Client Alert" OnChoice=ServerAlertChoice
            Font-Names="Arial" HorizontalAlign=Center Width=350px Height=140px>
            This is a rich alert box that was triggered by<br /><i>client-side code</i>.<br />
            The button will take the value that you chose.<br /><br />
        </ms:Alert>
        <asp:Button ID=ServerShowButton runat=server Text="Postback and show alert" OnClick=ServerShow /><br />
        <input type=button name=ClientShowButton value="Show alert without posting back"
            onclick="this.value=<%= ClientAlert.GetShowClientEvent() %>;" /><br />
        <ms:ConfirmButton ID=Confirm runat=server OnClick=ConfirmClick
            Text="Confirm Button" ConfirmText="Are you sure you want to press this button?" /><br />
        <ms:ConfirmButton ID=ConfirmClone runat=server OnClick=ConfirmClick
            Text="Confirm Button with the same confirm text" ConfirmText="Are you sure you want to press this button?" /><br />
        <ms:ConfirmButton ID=Confirm2 runat=server OnClick=ConfirmClick
            Text="Confirm Button" ConfirmText="Are you really, really sure you want to press this button?" /><br />
        <asp:Label ID=AlertResult runat=server ForeColor=Red Visible=false />
        <asp:Label ID=ConfirmResult runat=server ForeColor=Red Visible=false>Please don't press this button again.</asp:Label><br />
        <asp:GridView
            AutoGenerateColumns="False" DataSourceID="AccessDataSource1" ID="GridView1" runat="server" DataKeyNames="ID">
            <Columns>
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                    SortExpression="ID" Visible="False"></asp:BoundField>
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name"></asp:BoundField>
                <asp:BoundField DataField="Alias" HeaderText="Alias" SortExpression="Alias"></asp:BoundField>
                <asp:TemplateField HeaderText="Command">
                    <ItemTemplate>
                        <ms:ConfirmButton ID="Confirm" runat="server"
                            Alert="GridDeleteConfirmAlert" CommandName="delete"
                            Text="Delete" /><br />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource DataFile="~/App_Data/customers.mdb" ID="AccessDataSource1"
            runat="server" SelectCommand="SELECT [ID], [Name], [Alias] FROM [Customers]"
            DeleteCommand="DELETE FROM [Customers] WHERE [ID] = ?">
            <DeleteParameters>
                <asp:Parameter Name="original_ID" Type="Int32" />
            </DeleteParameters>
        </asp:AccessDataSource>
        <ms:Alert ID="GridDeleteConfirmAlert" runat=server Buttons=YesNo Title="Are you sure?"
            Font-Names="Arial" HorizontalAlign=Center Width=320px Height=50px>
            Are you sure you want to delete this row?
        </ms:Alert>
    </div>
    </form>
</body>
</html>
